package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.PlatformsMapper;
import com.ruoyi.system.domain.Platforms;
import com.ruoyi.system.service.IPlatformsService;

/**
 * 平台Service业务层处理
 * 
 * @author zzbird
 * @date 2023-11-14
 */
@Service
public class PlatformsServiceImpl implements IPlatformsService 
{
    @Autowired
    private PlatformsMapper platformsMapper;

    /**
     * 查询平台
     * 
     * @param platformId 平台主键
     * @return 平台
     */
    @Override
    public Platforms selectPlatformsByPlatformId(Long platformId)
    {
        return platformsMapper.selectPlatformsByPlatformId(platformId);
    }

    /**
     * 查询平台列表
     * 
     * @param platforms 平台
     * @return 平台
     */
    @Override
    public List<Platforms> selectPlatformsList(Platforms platforms)
    {
        return platformsMapper.selectPlatformsList(platforms);
    }

    /**
     * 新增平台
     * 
     * @param platforms 平台
     * @return 结果
     */
    @Override
    public Platforms insertPlatforms(Platforms platforms)
    {
        platforms.setCreateTime(DateUtils.getNowDate());
        Long affectedRows = platformsMapper.insertPlatforms(platforms);
        Long generatedKey = platforms.getPlatformId();
        return platforms;
    }

    /**
     * 修改平台
     * 
     * @param platforms 平台
     * @return 结果
     */
    @Override
    public int updatePlatforms(Platforms platforms)
    {
        platforms.setUpdateTime(DateUtils.getNowDate());
        return platformsMapper.updatePlatforms(platforms);
    }

    /**
     * 批量删除平台
     * 
     * @param platformIds 需要删除的平台主键
     * @return 结果
     */
    @Override
    public int deletePlatformsByPlatformIds(Long[] platformIds)
    {
        return platformsMapper.deletePlatformsByPlatformIds(platformIds);
    }

    /**
     * 删除平台信息
     * 
     * @param platformId 平台主键
     * @return 结果
     */
    @Override
    public int deletePlatformsByPlatformId(Long platformId)
    {
        return platformsMapper.deletePlatformsByPlatformId(platformId);
    }
}
